package com.jacarrichan.demo.sca.controller;

import org.apache.activemq.command.ActiveMQTopic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class NotificacionController {
    private Logger logger = LoggerFactory.getLogger(this.getClass());
    @Value("${notificacion.template.alta: Alta}")
    private String mensajeAlta;

    @Value("${notificacion.template.compra: Compra}")
    private String mensajeCompra;

    @Autowired
    private JmsTemplate jmsTemplate;

    @RequestMapping(path = "/", method = RequestMethod.GET)
    public void publiqueNoticiaciones() {
        logger.error("=====================");
        jmsTemplate.convertAndSend(new ActiveMQTopic("notificaciones"), "message");
    }

}